import React from 'react';
import echarts from 'echarts';
import { Button } from 'antd';
import Echart from './components/Echart';
import PieEchart from './components/pieEchart';

class EchartsTest extends React.Component {
    state = {
        seriesData: [],   // Echart表数据
        xAxis: []
    }

    showEchart = () => {
    
        // 使用刚指定的配置项和数据显示图表。
       this.setState({
            seriesData: [
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            ],
            xAxis: [
                "2020-09-09 00:00:22", "2020-09-09 00:00:52",
                 "2020-09-09 00:01:22", "2020-09-09 00:01:52",
                  "2020-09-09 00:02:22", "2020-09-09 00:02:52", 
                  "2020-09-09 00:03:22", "2020-09-09 00:03:52", 
                  "2020-09-09 00:04:22", "2020-09-09 00:04:5", 
                  "2020-09-09 00:05:22", "2020-09-09 00:05:52",
            ]
       })
       
    }

    componentDidMount() {
       
        
    }

    render() {
        const { seriesData, xAxis } = this.state;
        return (
            <>
                <h2>Echarts 展示</h2>
                <Button type="primary" onClick={this.showEchart}>展示</Button>
                <Echart 
                    xAxis={xAxis}
                    seriesData={seriesData}
                />
                <PieEchart />
            </>
        )
    }
}

export default EchartsTest;